package com.mk.cloud.common.domain;
import org.beetl.sql.core.annotatoin.AssignID;
import org.beetl.sql.core.annotatoin.Param;
import org.beetl.sql.core.mapper.BaseMapper;

import javax.persistence.Transient;
import java.io.Serializable;
import java.math.*;
import java.util.Date;
import java.sql.Timestamp;
import java.util.List;

/*
* 
* gen by beetlsql 2018-04-04
*/
public class POrder   implements Serializable{
	//订单编号 OSyyyymmddhhmmssxxxxxxx
	@AssignID
	private String orderid ;
	//地址
	private String address ;
	//地区
	private String area ;
	//买家留言
	private String buyercomment ;
	//买家名称
	private String shopname ;
	//市
	private String city ;

	private String citycode ;

	//完成时间
	private String finishdate ;
	//create用户ID
	private String fuserid ;
	//线下处理人
	private String oprateruserid ;
	//订单金额
	private BigDecimal orderamount ;
	//订单状态 1待付款 2已付款 3线下已处理
	private String orderstate ;
	//付款时间
	private String paydate ;
	//支付ID
	private String payid ;
	//支付方式
	private String paytype ;
	//订单商品
	private String pdid ;
	//电话
	private String phone ;
	//省
	private String province ;
	//收件人
	private String recipients ;
	//下单时间
	private String underdate ;
	//邮政编码
	private String zipcode ;

	private String coid;
	//微信下单结果,用于一次未支付的订单
	private String wechatpayorder;
	//订单关闭时间
	private String closedate;

	@Transient
	private String pdname;
	@Transient
	private String img;
	@Transient
	private String number;

	public String getCoid() {
		return coid;
	}

	public void setCoid(String coid) {
		this.coid = coid;
	}
	
	public POrder() {
	}

	public String getWechatpayorder() {
		return wechatpayorder;
	}

	public String getClosedate() {
		return closedate;
	}

	public void setClosedate(String closedate) {
		this.closedate = closedate;
	}

	public void setWechatpayorder(String wechatpayorder) {
		this.wechatpayorder = wechatpayorder;
	}

	public String getPdname() {
		return pdname;
	}

	public void setPdname(String pdname) {
		this.pdname = pdname;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getCitycode() {
		return citycode;
	}

	public void setCitycode(String citycode) {
		this.citycode = citycode;
	}

	public String getOrderid(){
		return  orderid;
	}
	public void setOrderid(String orderid ){
		this.orderid = orderid;
	}
	
	public String getAddress(){
		return  address;
	}
	public void setAddress(String address ){
		this.address = address;
	}
	
	public String getArea(){
		return  area;
	}
	public void setArea(String area ){
		this.area = area;
	}
	
	public String getBuyercomment(){
		return  buyercomment;
	}
	public void setBuyercomment(String buyercomment ){
		this.buyercomment = buyercomment;
	}

	public String getShopname() {
		return shopname;
	}

	public void setShopname(String shopname) {
		this.shopname = shopname;
	}

	public String getCity(){
		return  city;
	}
	public void setCity(String city ){
		this.city = city;
	}
	
	public String getFinishdate(){
		return  finishdate;
	}
	public void setFinishdate(String finishdate ){
		this.finishdate = finishdate;
	}
	
	public String getFuserid(){
		return  fuserid;
	}
	public void setFuserid(String fuserid ){
		this.fuserid = fuserid;
	}
	
	public String getOprateruserid(){
		return  oprateruserid;
	}
	public void setOprateruserid(String oprateruserid ){
		this.oprateruserid = oprateruserid;
	}
	
	public BigDecimal getOrderamount(){
		return  orderamount;
	}
	public void setOrderamount(BigDecimal orderamount ){
		this.orderamount = orderamount;
	}
	
	public String getOrderstate(){
		return  orderstate;
	}
	public void setOrderstate(String orderstate ){
		this.orderstate = orderstate;
	}
	
	public String getPaydate(){
		return  paydate;
	}
	public void setPaydate(String paydate ){
		this.paydate = paydate;
	}
	
	public String getPayid(){
		return  payid;
	}
	public void setPayid(String payid ){
		this.payid = payid;
	}
	
	public String getPaytype(){
		return  paytype;
	}
	public void setPaytype(String paytype ){
		this.paytype = paytype;
	}
	
	public String getPdid(){
		return  pdid;
	}
	public void setPdid(String pdid ){
		this.pdid = pdid;
	}
	
	public String getPhone(){
		return  phone;
	}
	public void setPhone(String phone ){
		this.phone = phone;
	}
	
	public String getProvince(){
		return  province;
	}
	public void setProvince(String province ){
		this.province = province;
	}
	
	public String getRecipients(){
		return  recipients;
	}
	public void setRecipients(String recipients ){
		this.recipients = recipients;
	}
	
	public String getUnderdate(){
		return  underdate;
	}
	public void setUnderdate(String underdate ){
		this.underdate = underdate;
	}
	
	public String getZipcode(){
		return  zipcode;
	}
	public void setZipcode(String zipcode ){
		this.zipcode = zipcode;
	}

	public interface Mapper extends BaseMapper<POrder> {

		/**
		 * 订单详情
		 * @param orderid
		 * @return
		 */
		POrder orderDetail(@Param("orderid") String orderid);

		/**
		 * 查询我推广的用户的第一个已支付订单
		 * @param fuserid
		 * @param pdtype 0新店体验,3爆品体验
		 * @return
		 */
		List<POrder> selectOrdersSubUserid(@Param("fuserid") String fuserid,@Param("pdtype") String pdtype);

		/**
		 * 查询自己在品牌区域的排名
		 * @param fuserid
		 * @param taid
		 * @return
		 */
		Integer selectNumberInTeamarea(@Param("fuserid") String fuserid,@Param("taid") String taid);

		/**
		 * 推店数
		 * @param fuserid
		 * @return
		 */
		Integer selectCountNum(@Param("fuserid") String fuserid);


		/**
		 * 关闭超时未支付的订单
		 * @param date
		 * @return
		 */
		Integer closeOrder(@Param("date")String date);

		/**
		 * 统计用户未关闭订单数
		 * @param fuserid
		 * @param pdid
		 * @return
		 */
		Integer countOrderNumber(@Param("fuserid") String fuserid,@Param("pdid") String pdid);

		/**
		 * 查询用户未关闭订单
		 * @param fuserid
		 * @param pdid
		 * @return
		 */
		POrder selectOnceOrder(@Param("fuserid") String fuserid,@Param("pdid") String pdid);
	}
	

}
